<%
layout("/layouts/platform.html"){
%>
<header class="header navbar bg-white shadow">
    <div class="btn-group tool-button">
        <a class="btn btn-primary navbar-btn" href="${base}/platform/sys/unit" data-pjax id="goback"><i class="ti-angle-left"></i> 返回</a>
    </div>
</header>

<div class="content-wrap">
    <div class="wrapper" style="min-height:500px;">
        <section class="panel panel-form">
            <form id="unitAddForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
                  action="${base}/platform/sys/unit/editDo" method="post">
                <input name="id" type="hidden" value="${obj.id!}">
                <input type="hidden" id="hasChildren" name="hasChildren" value="${obj.hasChildren!}">
                <div class="row mb10">
                    <div class="col-lg-12">
                        <input type="hidden" name="parentId" value="<%if(!isEmpty(parentUnit)){%>${parentUnit.id}<%}%>">
                        <!--<div class="form-group has-feedback">-->
                            <!--<label for="parentId" class="col-sm-2 control-label">上级单位</label>-->

                            <!--<div class="col-sm-8">-->
                                <!--<div class="input-group">-->
                                    <!--<input id="parentId" type="text" class="form-control" placeholder="不选择默认为顶级单位" disabled-->
                                           <!--value="<%if(!isEmpty(parentUnit)){%>${parentUnit.name}<%}%>"/>-->

			                             		<!--<span class="input-group-btn">-->
			                             			<!--<button type="button" class="btn btn-primary" data-toggle="modal"-->
                                                            <!--data-target="#dialogSelectParentUnit"><i class="ti-plus"></i>选择-->
                                                    <!--</button>-->
			                             		<!--</span>-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label">单位名称</label>

                            <div class="col-sm-8">
                                <input type="text" id="name" class="form-control" name="name" data-parsley-required="true"
                                       placeholder="单位名称" value="${obj.name!}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="unitcode" class="col-sm-2 control-label">机构代码</label>

                            <div class="col-sm-8">
                                <input type="text" id="unitcode" class="form-control" name="unitcode"
                                       placeholder="机构代码" value="${obj.unitcode!}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="note" class="col-sm-2 control-label">单位介绍</label>

                            <div class="col-sm-8">
                                <input type="text" id="note" class="form-control" name="note" placeholder="单位介绍" value="${obj.note!}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">单位地址</label>

                            <div class="col-sm-8">
                                <input type="text" id="address" name="address" class="form-control" placeholder="单位地址" value="${obj.address!}">

                            </div>
                        </div>
                        <div class="form-group">
                            <label for="telephone" class="col-sm-2 control-label">联系电话</label>

                            <div class="col-sm-8">
                                <input type="text" id="telephone" name="telephone" class="form-control" placeholder="联系电话" value="${obj.telephone!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3"></div>
                <div class="col-lg-6">
                    <div class="form-group text-center">
                        <label></label>

                        <div>
                            <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
                        </div>
                    </div>
                </div>
            </form>
        </section>

    </div>
</div>
<a class="exit-offscreen"></a>
<script language="JavaScript">
    $(document).ready(function () {
        $('#unitAddForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code==0) {
                    Toast.success(data.msg);
                    setTimeout(function () {
                        $("#goback").trigger("click");
                    }, 1000);
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
    });
</script>

<%}%>